package mycoffee.order.task;

import java.util.ArrayList;

import mycoffee.order.activity.MyCoffeeApplication;
import mycoffee.order.model.Order;
import android.content.Context;

public class OrderQueryTask extends AbstractTask<Void, Void, ArrayList<Order>> {

	private boolean mIsOrderTemp = false;

	public OrderQueryTask(Context context,
			IDataEventHandler<ArrayList<Order>> dataEventHandler,
			boolean isTempOrder) {
		super(context, dataEventHandler);
		mIsOrderTemp = isTempOrder;

	}

	@Override
	protected ArrayList<Order> doExecute() {
		ArrayList<Order> result = null;
		if (MyCoffeeApplication.mDatabaseConnection != null) {
			result =  MyCoffeeApplication.mDatabaseConnection
					.getListOrders(mIsOrderTemp);
		}
		
		return result;
	}
}
